package tr.edu.yildiz.test;

import tr.edu.yildiz.markov.education.Educator;
import tr.edu.yildiz.markov.viterbi.ViterbiCalculator;
import tr.edu.yildiz.util.LoggerUtils;

/**
 * General unit tester
 * 
 * @author Onur Ulusu
 * 
 */
public class UnitTester {
	private static final String TEST_WORD = "adfanfwd";

	public static void main(String[] args) {
		LoggerUtils.initializeLog4j();
		Educator educator = new Educator();
		educator.educateFromFile();
		educator.prepareInitialStateProbability();
		educator.prepareStateTransitionProbabilityMatrix();

		educator.getFaultyWordsFromFile();
		educator.prepareOutputProbabilityMatrix();

		ViterbiCalculator viterbiCalc = new ViterbiCalculator();
		String hiddenWord = viterbiCalc.viterbi(TEST_WORD,
				educator.initialStateProbs, educator.stateTransitionProbMatrix,
				educator.outputProbabilityMatrix);

		System.out.println("TEST WORD IS: \t" + TEST_WORD);
		System.out.println("HIDDEN WORD IS: " + hiddenWord);

	}
}
